package com.example.explainus;

import com.example.units.GlobalParameters;
import com.example.units.GlobalVariables;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.SeekBar;
import android.widget.TextView;

public class GameSettingsActivity extends Activity 
{

	private Button bSetOk;
	private TextView mainTxt;
	private TextView countTxt;
	private SeekBar rollerBar;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) 
	{
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_gamesettings);
		bSetOk = (Button)findViewById(R.id.bSetOk);
		mainTxt = (TextView)findViewById(R.id.textView1);
		countTxt = (TextView)findViewById(R.id.tCountWords);
		rollerBar = (SeekBar)findViewById(R.id.sRoller);
		GlobalParameters.overrideFonts(this, bSetOk);
		GlobalParameters.overrideFonts(this, mainTxt);
		GlobalParameters.overrideFonts(this, countTxt);
		rollerBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
			
			@Override
			public void onStopTrackingTouch(SeekBar seekBar) {
				countTxt.setText(String.valueOf(rollerBar.getProgress()));
				
			}
			
			@Override
			public void onStartTrackingTouch(SeekBar seekBar) {
				// TODO Auto-generated method stub
				
			}
			
			@Override
			public void onProgressChanged(SeekBar seekBar, int progress,
					boolean fromUser) {
				countTxt.setText(String.valueOf(rollerBar.getProgress()));
				
			}
		});
	}
	
	public void goSetSettings(View v)
	{
		GlobalVariables.countWords = rollerBar.getProgress();
		bSetOk.setBackgroundResource(R.drawable.button_boarder_mini_change);
		Intent start = new Intent(GameSettingsActivity.this, NewGameActivity.class);
		startActivity(start);
		finish();
	}
	
}
